Skip to content

Upgrade WLED.NET JSON API coverage and ergonomics#15

Merged
kevbite merged 32 commits into
masterfrom
feature/wled-json-api-upgrade
May 30, 2026
Merged

Upgrade WLED.NET JSON API coverage and ergonomics#15
kevbite merged 32 commits into
masterfrom
feature/wled-json-api-upgrade

Conversation

@kevbite
Copy link
Copy Markdown
Owner

@kevbite kevbite commented May 30, 2026

This pull request introduces a foundational overhaul to modernize the WLED.NET library, focusing on updating target frameworks, improving documentation, and laying out a clear development roadmap. The main goals are to support modern .NET versions, improve developer experience with strong typing and fluent APIs, and provide clear documentation and plans for future enhancements.

Key changes include:

Target Framework Modernization

  • Multi-targeting support is added for net8.0, net9.0, net10.0, and netstandard2.0 in Directory.Build.props, ensuring compatibility with both modern and legacy consumers. Test and sample projects are also updated to target modern frameworks.
  • The Docker build environment is updated to use the .NET 10 SDK, enabling builds and tests for the latest frameworks.

Documentation & Roadmap

  • A comprehensive CHANGELOG.md is introduced, documenting the breaking changes, new features (such as strong value types, fluent builders, intent methods, DI integration, and a typed exception hierarchy), and removals of legacy APIs.
  • The README.md is rewritten to reflect the new API design, usage patterns, supported frameworks, error handling, and feature matrix, making it easier for developers to get started and understand the library's capabilities.
  • Two new roadmap documents are added:
    • Plan 0: Details the motivation and steps for updating target frameworks and toolchains.
    • Plan 1: Outlines the introduction of strong value types and enums to replace primitive types, improving safety and clarity.

Solution Structure

  • The solution file (WLED.NET.sln) is updated to include the new Kevsoft.WLED.DependencyInjection project and ensure correct build configurations across all target frameworks. [1] [2] [3]

Most important changes:

1. Target Framework and Build Modernization

  • Added multi-targeting for net8.0, net9.0, net10.0, and netstandard2.0 in Directory.Build.props to support both legacy and modern consumers.
  • Upgraded the Docker build environment to use the .NET 10 SDK for CI, ensuring compatibility with the latest frameworks.

2. Documentation and Developer Guidance

  • Introduced a detailed CHANGELOG.md documenting all notable changes, breaking updates, and new features in the overhaul.
  • Rewrote README.md to reflect the new API surface, usage patterns, dependency injection, error handling, and supported features.

3. Roadmap and Planning

  • Added Plan 0 and Plan 1 documents outlining the motivation, goals, and steps for updating target frameworks and introducing strong value types/enums. [1] [2]

4. Solution Structure Updates

  • Updated WLED.NET.sln to include the new dependency injection project and ensure correct build matrix for all frameworks. [1] [2] [3]

kevbite added 30 commits May 29, 2026 22:33
- Add intent methods (TurnOn/TurnOff/Toggle/SetBrightness/SetColor/SetEffect/SetPalette/Reboot)
- Add CancellationToken to every client method
- Add typed exception hierarchy (WledException + connection/response/version)
- Add HttpClient constructor and Kevsoft.WLED.DependencyInjection AddWledClient
- Add intent, exception and DI tests
… sample

- Rewrite README around intent methods, fluent builders, DI and error handling
- Add a supported-features capability matrix and document target frameworks
- Add CHANGELOG.md (Keep a Changelog format)
- Rewrite BasicConsole sample to showcase the ergonomic API
Model the state 'seg' field as a union (SegmentPayload) that serializes as either
an object (selected segments) or an array (id-targeted), matching the WLED API.
No-id SetColor/SetEffect/SetPalette now emit the object form instead of an array
that WLED would infer as id:0.
Model id.mdns, if.mqtt (en/broker/port/user/cid) and def (on/bri/ps) as typed
properties while keeping JsonExtensionData as an escape hatch for everything else.
Add root AGENTS.md with project conventions, commands and gotchas.
Add EffectCatalog/PaletteCatalog with id/name lookup, reserved-entry
filtering (RSVD/-), and SetEffect/SetPalette catalog-entry overloads.
StateUpdate.SelectedSegments(...) targets the selected segments via the
seg object form and accumulates across calls. Mixing it with Segment(id, ...)
in one update throws, since WLED's seg field is one form or the other.
GetDevice() issues a single GET /json and exposes state, info and typed
effect/palette catalogs as one snapshot, with per-segment effect/palette
resolution and derived helpers (SelectedSegments, ActiveSegments,
SupportsWhiteChannel, etc). Effect metadata is opt-in to avoid extra requests.
Add lookup helpers (FindById/FindByName/Try*) over effect metadata
collections, plus SegmentUpdate.Effect(EffectMetadata) and
ApplyEffectDefaults(EffectMetadata) to set speed/intensity/custom sliders
from metadata defaults (c3 clamped to 0-31).
Introduce SegmentId, EffectId, PaletteId, PresetId, PlaylistId,
LedMapId, SegmentBounds and MatrixBounds readonly structs with range
validation, equality and netstandard2.0-safe hashing. Wire SegmentBounds
and MatrixBounds into SegmentUpdate.Range/Range2D and LedMapId into
StateUpdate.LoadLedMap as non-ambiguous overloads.
Introduce ConfigUpdate and an UpdateConfig(Action<ConfigUpdate>) client
overload exposing Identity, Mqtt and BootDefaults helpers. Only touched
sections and fields are serialised, reusing the existing network opt-in
guard.
Add README sections and feature-matrix rows for the device snapshot,
catalogs, selected-segment updates, strong value types and the fluent
config builder; expand the CHANGELOG and BasicConsole sample to match.
@kevbite kevbite marked this pull request as ready for review May 30, 2026 16:57
Copilot AI review requested due to automatic review settings May 30, 2026 16:57
@kevbite kevbite self-assigned this May 30, 2026
@kevbite kevbite added the enhancement New feature or request label May 30, 2026
Copy the Kevsoft.WLED.DependencyInjection csproj and sources so dotnet
restore (which reads the solution) and the build/pack stages succeed.
Build the DI project (transitively building the main library) instead of
globbing multiple csproj into a single dotnet build, and pack each
packable library explicitly. Also align FROM..AS keyword casing.
@kevbite kevbite merged commit 71cadf0 into master May 30, 2026
1 check passed
@kevbite kevbite review requested due to automatic review settings May 30, 2026 17:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant